<template>
  <BaseSearchForm v-model:search-param="checkParam"
    @goBack="emit('goto-edit')"
    @search="search">
  </BaseSearchForm>
  <div class="tableBox">
    <MkTable :data="list" border @row-dblclick="rowDbClick">
        <el-table-column label="申请单号" prop="traApplyBliiNo" />
        <el-table-column label="标本号" prop="sampleNo" />
        <el-table-column label="标本状态" prop="sampleStatus" />
      <el-table-column label="绑定时间" prop="bindingTime" />
    </MkTable>
    <div style="text-align: center; width: 100%;">
      <MkPagination v-model:page="checkParam.page"
        v-model:pageSize="checkParam.pageSize"
        :total="total"
        @query="search" />
    </div>
    
  </div>
</template>

<script lang='ts' setup>

//单表List基本操作
import { ref,reactive } from 'vue';
const emit = defineEmits(['goto-edit'])
const rowDbClick = (row: any) => {
  emit('goto-edit', row)
}
interface list {
  traApplyBliiNo: string;
  sampleNo: string;
  sampleStatus:number,
  bindingTime: string
}

const list = ref<list[]>([])

const alllist = ref<list[]>([])
  alllist.value = [{
  traApplyBliiNo:'2025001',
  sampleNo:'1',
  sampleStatus:1,
  bindingTime:'12025-03-15',
},{
  traApplyBliiNo:'2025002',
  sampleNo:'1',
  sampleStatus:1,
  bindingTime:'12025-03-15',
}].sort((a, b) => new Date(b.bindingTime).getTime() - new Date(a.bindingTime).getTime());

const total = ref(0)

const checkParam = reactive({
	keyword: undefined,
	startCreationTime: undefined,
	endCreationTime: undefined,
  page:1,
  pageSize:10
});

const search = () => { 
  total.value = alllist.value.length;
  list.value = [...alllist.value.slice((checkParam.page -1 ) * checkParam.pageSize,checkParam.page * checkParam.pageSize)]

}

defineExpose({ search })


</script>

<style lang='scss' scoped>
</style>